import { defineStore } from 'pinia'
import axios from 'axios'
import { ta } from 'element-plus/es/locales.mjs'
interface User {
  title: string,
  content: string,
  userid: number,
  tags: [string]
}
export const useCreateArticle = defineStore('createArticle', {
  state: () => {
    return {
      Title: '',
      content: '',
      Userid: 1,
    }
  },
  actions: {
    async articleCreate(token: string, index: User) {
      const response = await axios.post(`http://192.168.1.3:8000/users/createArticle`,
        index,
        { headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' }, }
      )
      return response;
    }
  }
})